﻿using System;

namespace Sendz.Domain
{
    // Skipping data annotations and validation in this class since it's primarily a data cross-reference class
    public class ResponseItem
    {
        // Entity
        public Guid ResponseItemKey { get; set; }
        public string Entry { get; set; }
        public DateTime CreatedOn { get; set; }

        // Parents
        public Guid ResponseKey { get; set; }
        public Response Response { get; set; }

        public Guid FormFieldKey { get; set; }
        public FormField FormField { get; set; }

        // Constructor
        public ResponseItem()
        {
            // Moved to a calculated column in the Entity Framework ORM (property StoreGeneratedPattern)
            // Ref: http://msdn.microsoft.com/en-us/library/ms189786.aspx
            // Ref: http://leedumond.com/blog/using-a-guid-as-an-entitykey-in-entity-framework-4/
            // this.ResponseItemKey = Guid.NewGuid();
            this.CreatedOn = DateTime.Now;
        }

        public ResponseItem(Guid responseKey, Guid formFieldKey, string entry)
        {
            // Moved to a calculated column in the Entity Framework ORM (property StoreGeneratedPattern)
            // this.ResponseItemKey = Guid.NewGuid();
            this.ResponseKey = responseKey;
            this.FormFieldKey = formFieldKey;
            this.Entry = entry;
            this.CreatedOn = DateTime.Now;
        }
    }
}
